import {request ,brandId} from "./request.js"

import qs from 'qs'
const get="GET";
const post ="POST";
const size=20;





//智能 上传实名认证图片接口
export function getApiIntelligenceNameImage(data){
    return request({
        url:"/user/app/add/user/realname/img",
        method:post,
        data:data
    })
}

//人工 上传实名认证图片接口
export function getApiuploadRealNameCertificationImage(data){
    return request({
        url:"user/app/upload/realname/",
        method:post,
        data:data
    })
}

//短信校验接口
export function getApiSMSVerification(phone,smsCode){
    return request({
        url:"notice/app/sms/verifysmscode",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "smsCode":smsCode
        })
    })
}


//修改用户昵称
export function getApinickName(nickName){
    return request({
        url:"user/app/update/users/nick/name",
        method:post,
        data:qs.stringify({
            "nickName":nickName
        })
    })
}

//修改头像接口
export function getApiUpdateHeaderImageInfo(data){
    return request({
        url:"user/app/headportrait/updateby/phone/",
        method:post,
        data:data
    })
}
//获取头像接口
export function getApiHeaderImageInfo(phone){
    return request({
        url:"user/app/headportrait/getby/phone/",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "brandId":brandId
        })
    })
}

//查询账户信息接口
export function getApiAccountInfo(token){
    return request({
        url:"user/app/account/query/"+token,
        method:get
    })
}

//分润返佣笔数
export function getApiDistributeProfit(){
    return request({
        url:"transactionclear/app/profit/distribute/count",
        method:post
    })
}

//查询一周收益接口
export function getApiOneWeekIncomeInfo(token){
    return request({
        url:"user/app/rebate/query/oneweek/"+token,
        method:post
    })
}


//查询总收益接口
export function getApiIncomeInfo(userId){
    return request({
        url:"user/app/rebate/query/sumrebate/",
        method:post,
        data:qs.stringify({
            "user_id":userId
        })
    })
}

//查询我的推广信息接口
export function getApiMySpreadInfo(token){
    return request({
        url:"user/app/usersys/query/"+token,
        method:post
    })
}



//查询推广信息
export function getApiSubMemberStatus(userId){
    return request({
        url:"user/app/query/userteam",
        method:post,
        data:qs.stringify({
            "userId":userId
        })
    })
}


//查询用户个人信息接口
export function getApiUserInfo(token){
    return request({
        url:"user/app/info/query/"+token,
        method:get,
    })
}


//查询新闻信息接口
export function getApiNewsInfo(classifiCation){
    return request({
        url:"user/app/news/getnewsby/brandidandclassification/andpage/",
        method:post,
        data:qs.stringify({
            "brandId":brandId,
            "classifiCation":classifiCation,
            // "size":size,
            // "page":page
        })
    })
}

//查询新闻分类接口
export function getApiNewsCategory(){
    return request({
        url:"user/app/newsclassification/getclassification/bybrandid/",
        method:post,
        data:qs.stringify({
            "brandId":brandId
        })
    })
}


//查询轮播图信息接口
export function getApiCarouselInfo(type=0){
    return request({
        url:"user/app/slideshow/query/brandid/",
        method:post,
        data:qs.stringify({
            "brand_id":brandId,
            "type": 0 // 0 :默认 ,1:额外 
        })
    })
}

//平台消息接口
export function getApiHistoryMessageInfo(token,page=0){
    return request({
        url:"user/app/jpush/history/brand/"+token,
        method:get,
        data:qs.stringify({
            "page":page,
            "size":size
        })
    })
}

//账号密码登录
export function getApiLogin(phone,password){
    return request({
        url:"/user/app/login/",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "password":password,
            "brand_id":brandId
        })
    })
}


// 短信登录接口
export function getApiSmsLogin(phone,vericode){
    return request({
        url:"user/app/smslogin",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "vericode":vericode,
            "brandId":brandId
        })
    })
}




//注册接口 
export function getApiRegister(phone,vericode,password,invitecode){
    return request({
        url:"/user/app/register/",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "vericode":vericode,
            "paypass":"123456",
            "password":password,
            "invitecode":invitecode,
            "brand_id":brandId
        })
    })
}

// 发短信
export function getApiSms(phone){
    return request({
        url:'notice/app/sms/send?phone='+phone+'&brand_id='+brandId,
        method:get
    })
}

// 忘记密码
export function getApiForgetPassword(phone,vericode,password){
    return request({
        url:"user/app/password/update/",
        method:post,
        data:qs.stringify({
            "phone":phone,
            "vericode":vericode,
            "password":password,
            "brandId":brandId
        })
    })
}
